

<div class="layui-input-inline"  data-refurl="{:addon_url('ChinaCity://ChinaCity/city')}&city={value}">
	<select name="province" id="J_province" >
		<option value="">请选择省</option>
		{volist name='addon_china_city_province_array' id='vo'}
		<option value="{$vo.id}" {eq name = 'vo.id' value ='$addon_china_city_province'}selected{/eq}>{$vo.name}</option>
		{/volist}
	</select>
</div>
<div class="layui-input-inline">
	<select  name="city" id="J_city" data-val="{$addon_china_city_city}" >
		<option value="">请选择市</option>

	</select>
</div>
<div class="layui-input-inline">
	<select  name="district" id="J_district"  data-val="{$addon_china_city_district}">
		<option value="">请选择县/区</option>
	</select>
</div>

<script>
	layui.use(['admin'], function(){
		var $ = layui.$;
		var pid = 1,
		cid = 2,did = 3;
//默认区县市id
		function change_province(pid){
			$.post("{:addon_url('ChinaCity://ChinaCity/getProvinces')}", {pid: pid}, function(result){
				$("#J_province").html(result);
			});
		}
		function change_city(p_pid,p_cid){
			$.post('{:addon_url("ChinaCity://ChinaCity/getCitys")}', {pid: p_pid, cid: p_cid}, function(result){
				$("#J_city").show().html(result);
			});

		}
		function change_district(p_cid,p_did){
			$.post('{:addon_url("ChinaCity://ChinaCity/getDistricts")}', {cid: p_cid, did: p_did}, function(result){
				$("#J_district").show().html(result);
			});
		}
		change_province(pid);
		change_city(pid,cid);
		change_district(cid,did);
		$('#J_province').change(function(){
			var pid_g = $(this).children('option:selected').val();
			change_city(pid_g);
			change_district(0);

		});

		$('#J_city').change(function(){
			var cid_g=$(this).children('option:selected').val();
			change_district(cid_g)


		});

		$('#J_district').change(function(){
			var did_g=$(this).children('option:selected').val();
		});
	});
</script>